"""
@author: Gaoyaoxia
@date: 2021-02-26 11:42:01
"""
<!-- 委员基本信息审核 -->
<template>
  <div class="base-table-box">
    <div class="table-select-group">
      <div class="left">
        <s-select
          :selectOption="member.searchType"
          v-model="params.searchType"
          style="width: 100px"
        />
        <a-input
          class="search-input"
          v-model="params.search"
          placeholder="请输入搜索内容"
        />

        <a-button style="margin-left: 16px" type="primary" @click="search"
          >查询</a-button
        >
        <a-button @click="reset" class="btn-reset">重置</a-button>
      </div>
      <div class="right">
        <a-button type="primary" @click="add">新增</a-button>
      </div>
    </div>
    <a-table
      style="margin-top: 10px"
      :pagination="pagination"
      :columns="columns"
      :data-source="tableData"
      :loading="loading"
      :scroll="{ x: '100%', y: '100%' }"
    >
      <span slot="name" slot-scope="text, record">
        <router-link
          class="link-a"
          :to="{
            path: 'detail',
            query: { id: record.id }
          }"
          >{{ text }}</router-link
        >
      </span>
      <template slot="status" slot-scope="text, record">
        {{ record.status }}
      </template>
      <span slot="action" slot-scope="text, record">
        <router-link
          :to="{ path: 'sessionlist/updatesession', query: { id: record.id } }"
          >修改</router-link
        >
        <a @click="onDelete(record)" class="btn-space">删除</a>
      </span>
    </a-table>
  </div>
</template>

<script>
import { member } from 'assets/js/select-option-list'
import paging from 'mixins/paging'
const columns = [
  {
    title: '序号',
    dataIndex: 'key',
    width: 50
  },
  {
    title: '届次编号',
    dataIndex: 'sId',
    width: 100,
    sorter: (a, b) => a.name.length - b.name.length
  },
  {
    title: '会议名称',
    dataIndex: 'sessionName',
    width: 200,
    scopedSlots: { customRender: 'sessionName' }
  },
  {
    title: '年份',
    dataIndex: 'strYear',
    width: 80,
    sorter: (a, b) => a.name.length - b.name.length
  },
  {
    title: '开始时间',
    dataIndex: 'startDate',
    width: 120,
    sorter: (a, b) => a.name.length - b.name.length
  },
  {
    title: '结束时间',
    dataIndex: 'endDate',
    width: 120,
    sorter: (a, b) => a.name.length - b.name.length
  },
  {
    title: '届次状态',
    dataIndex: 'status',
    align: 'center',
    width: 100,
    sorter: (a, b) => a.name.length - b.name.length
  },
  {
    title: '操作',
    dataIndex: 'action',
    width: 100,
    scopedSlots: { customRender: 'action' }
  }
]
export default {
  mixins: [paging],
  components: {},
  data() {
    return {
      columns,
      member,
      tabTypes: [
        { key: '', label: '全部', num: '' },
        { key: '0', label: '待审核', num: 1 },
        { key: '1', label: '已通过', num: 0 },
        { key: '2', label: '不通过', num: 0 }
      ],
      params: {
        strSector: '',
        strFaction: '',
        searchType: 'all',
        auditStatus: ''
      },
      currentIndex: 0,
      count: 0,
      tableData: []
    }
  },
  computed: {},
  watch: {},
  mounted() {},
  methods: {
    getTableData(params = this.params) {
      console.log('参数：', params)
      // for (let i = 0; i < this.pagination.pageSize; i++) {
      this.tableData.push({
        key: 1,
        id: 'ID01',
        sId: '1404',
        sex: '男',
        sessionName: '安徽省政协委员会十三届四次',
        strYear: '2021',
        startDate: '2021-02-03',
        endDate: '2021-12-03',
        status: '本届'
      })
      // }
      this.pagination.total = this.tableData.length
    },
    changeTab(tab, index) {
      this.currentIndex = index
      this.params.auditStatus = tab.key
      this.getTableData(this.params) //传入当前选择的tab
    },
    search() {
      console.log('search:', this.params)
    },
    reset() {
      this.form = {}
    },
    add() {
      this.$router.push('sessionlist/addsession')
    },
    //删除该记录
    onDelete(record) {
      this.$confirm({
        title: '您是否确认要操作所选中的记录？',
        onOk() {
          //请求删除接口
        },
        onCancel() {}
      })
    }
  },
  created() {}
}
</script>
<style lang='less' scoped>
.base-table-box .table-select-group {
  margin-bottom: 0px;
}
.tab-select-group {
  margin-top: 20px;
  margin-left: 10px;
  ul li {
    float: left;
    font-size: 14px;
    line-height: 20px;
    padding: 10px 15px;
    color: #666666;
    cursor: pointer;
    border-radius: 2px;
    margin-right: 25px;
    span {
      vertical-align: middle;
    }
  }
  .active {
    background-color: #e6f2f9;
    color: #097bc7;
  }
}
</style>